package com.xmx.controller;

import com.xmx.entity.ServiceType;
import com.xmx.service.IServiceTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * overview：
 * author:ZhaoZH
 * 2023年05月07日 18:03
 */
@Controller
public class ServiceTypeController {
    @Autowired
    private IServiceTypeService iServiceTypeService;


    @RequestMapping("/queryAllServiceType")
    public String queryAllServiceType(Map map){
        System.out.println("jinlaide");
        List<ServiceType> typeList = iServiceTypeService.queryAllService();
        System.out.println("得到的李斯特："+typeList);
        map.put("typeList",typeList);
        return "Manager/serviceTypeManage";
    }
    @RequestMapping("/deletetypeBystId")
    @ResponseBody
    public String deletetypeBystId(Integer id){
        iServiceTypeService.deleteServiceByid(id);
        return "1";
    }
    @RequestMapping("/addnewService")
    public String addnewService(ServiceType serviceType){
        iServiceTypeService.addNewService(serviceType);
        return "redirect:queryAllServiceType";
    }
}
